from typing import List


class Solution:
    def rotate(self, matrix: List[List[int]]) -> None:
       n = len(matrix)
       a = 0
       b = n-1
       while a < b:
           x1, y1 = a, a
           x2, y2 = b, b
           for i in range(y2-y1):
               t = matrix[x1][y1 + i]
               matrix[x1][y1 + i] = matrix[x2 - i][y1]
               matrix[x2 - i][y1] = matrix[x2][y2 - i]
               matrix[x2][y2 - i] = matrix[x1 + i][y2]
               matrix[x1 + i][y2] = t
           a += 1
           b -= 1
